const TransformPages = require('uni-read-pages')

const {
	webpack
} = new TransformPages()

// const CompressionWebpackPlugin = require('compression-webpack-plugin')
// const productionGzipExtensionszipExtensions = ['js', 'css']
module.exports = {
	configureWebpack: {
		plugins: [
			new webpack.DefinePlugin({
				ROUTES: webpack.DefinePlugin.runtimeValue(() => {
					const tfPages = new TransformPages({
						includes: ['path', 'name', 'aliasPath', 'meta']
					});
					return JSON.stringify(tfPages.routes)
				}, true)
			})
			
			// new CompressionWebpackPlugin({
			// 	filename: '[path].gz[query]',
			// 	algorithm: 'gzip',
			// 	test: new RegExp('\\.(' + productionGzipExtensions.join('|') + ')$'),//匹配文件名
			// 	threshold: 10240,//对10K以上的数据进行压缩
			// 	minRatio: 0.8,
			// 	deleteOriginalAssets:false,//是否删除源文件
			// })
		]
	},
}